#include "Thread.hpp"
#include <unistd.h>
using namespace hyc;

struct person
{
    person(int age, std::string name)
        : _age(age), _name(name)
    {
    }

    int _age;
    std::string _name;
};

void run(person x)
{
    std::cout << "新线程运行中" << std::endl;
    while (true)
    {
        std::cout << "年龄：" << x._age << std::endl;
        std::cout << "姓名：" << x._name << std::endl;
        sleep(1);
    }
}

int main()
{
    Thread<person> thread(run, person(12, "huang"));
    thread.Start();

    sleep(2);

    thread.Detach();

    sleep(2);

    thread.Stop();
}